package cu.tedu.egmvc2.controller;

import cu.tedu.egmvc2.mapper.AddressMapper;
import cu.tedu.egmvc2.pojo.dto.AddressDTO;
import cu.tedu.egmvc2.pojo.entity.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/address/")
public class AddressController {
    @Autowired
    private AddressMapper addressMapper;

    @RequestMapping("insert")
    public String insert(AddressDTO addressDTO) {
        return "添加成功" + addressMapper.insert(addressDTO);
    }


    @RequestMapping("select")
    public String select() {
        return "查询成功" + addressMapper.select();
    }

    @RequestMapping("delete")
    public String delete(int id) {

        return "删除成功" + addressMapper.delete(id);
    }

    @RequestMapping("update")
    public String update(Address address){
        return "修改成功"+addressMapper.update(address);
    }
}
